/******************************************************************************* * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.ui.internal.keys; import java.util.Comparator; import org.eclipse.ui.keys.ModifierKey; /** * Compares modifier keys lexicographically by the name of the key. * * @since 3.0 */ public class AlphabeticModifierKeyComparator implements Comparator { @Override public int compare(Object left, Object right) { ModifierKey modifierKeyLeft = (ModifierKey) left; ModifierKey modifierKeyRight = (ModifierKey) right; return modifierKeyLeft.toString() .compareTo(modifierKeyRight.toString()); } }